<?php

$database = include('database.php');
function recursiveArrayChangeKeyCase(array $arr, $type = CASE_UPPER): array
{
    foreach ($arr as $key => $value):
        $action = $type == CASE_UPPER ? 'strtoupper' : 'strtolower';
        unset($arr[$key]);
        $arr[$action($key)] = is_array($value)
            ? recursiveArrayChangeKeyCase($value, $type) : $value;
    endforeach;
    return $arr;
}

print_r(recursiveArrayChangeKeyCase($database, CASE_LOWER));

function recursiveArrayChangeValueCase(array $arr, $type = CASE_UPPER): array
{
    foreach ($arr as $k => $v) {
        $action = $type == CASE_UPPER ? 'strtoupper' : 'strtolower';
        $arr[$k] = is_array($v) ? recursiveArrayChangeValueCase($v, $type) : $action($v);
    }
    return $arr;
}

print_r(recursiveArrayChangeValueCase($database, CASE_LOWER));